<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品列表</title>
</head>
<body>
	<table border=1>
		<tr>
			<td>商品名</td>
			<td>描述</td>
			<td>商品图</td>
			<td>价格</td>
			<td>折后价</td>
			<td>操作</td>
			
		</tr>
		<c:forEach items="${products }" var="p">
		<tr>
			<td>${p.name}</td>
			<td>${p.description}</td>
			<td><img src="images/${p.listimg}" height="100 px" width="200 px"/></td>
			<td>${p.price}</td>
			<td>${p.discountprice}</td>
			<td><a href="deleteProduct?id=${p.id}">删除</a>
			<a href="selectProduct?id=${p.id}">修改</a></td>
		</tr>
		</c:forEach>
	</table>
	<p>当前总共${page.total}条记录、共${page.pages}页、每页${page.pageSize}条记录、当前是第${page.pageNum }页</p>
	<c:if test="${page.isFirstPage==true }"><a>首页</a></c:if>
	<c:if test="${page.isFirstPage==false }">
	<a href="selectAllProducts?pageNum=${page.firstPage }">首页</a>
	</c:if>
	<c:if test="${page.hasPreviousPage==false }"><a>上一页</a></c:if>
	<c:if test="${page.hasPreviousPage==true }">
	<a href="selectAllProducts?pageNum=${page.prePage }">上一页</a>
	</c:if> 
	<c:if test="${page.hasNextPage==false }"><a>下一页</a></c:if>
	<c:if test="${page.hasNextPage==true }">
	<a href="selectAllProducts?pageNum=${page.nextPage }">下一页</a>
	</c:if> 
	<c:if test="${page.isLastPage==true }"><a>末页</a></c:if>
	<c:if test="${page.isLastPage==false }">
	<a href="selectAllProducts?pageNum=${page.lastPage }">末页</a>
	</c:if>     
</body>
</html>